import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
  },
  {
    name: 'login',
    path: '/login',
    component: () => import('@/views/login/login'),
    meta: {
      title: '登录',
    }
  },
  {
    name: 'login-info',
    path: '/login-info',
    component: () => import('@/views/login/info'),
    meta: {
      title: '房主信息确认',
    }
  },
  {
    name: 'menu',
    path: '/menu',
    component: () => import('@/views/menu/menu'),
    meta: {
      title: '核验菜单',
    }
  },
  {
    name: 'inspection-building-list',
    path: '/inspection/building-list',
    component: () => import('@/views/inspection/buildingList'),
    meta: {
      title: '房屋列表',
    }
  },
  {
    name: 'inspection-mapbox',
    path: '/inspection/mapbox',
    component: () => import('@/views/inspection/mapbox'),
    meta: {
      title: '房屋',
    }
  },
  {
    name: 'inspection-check-self',
    path: '/inspection/check-self',
    component: () => import('@/views/inspection/checkSelfData'),
    meta: {
      title: '自查信息',
    }
  },
  {
    name: 'inspection-village-collect',
    path: '/inspection/village-collect',
    component: () => import('@/views/inspection/villageCollect'),
    meta: {
      title: '防火检查',
    }
  },
  {
    name: 'inspection-village-check',
    path: '/inspection/village-check',
    component: () => import('@/views/inspection/villageCheck'),
    meta: {
      title: '防火检查',
    }
  },
  {
    name: 'govern-result',
    path: '/govern-result',
    component: () => import('@/views/governResult/governResult'),
    meta: {
      title: '攻坚治理信息填报',
    }
  },
  {
    name: 'check-record-record',
    path: '/check-record/record',
    component: () => import('@/views/checkRecord/record'),
    meta: {
      title: '检查记录',
    }
  },
  {
    name: 'check-record-record-type',
    path: '/check-record/recordType',
    component: () => import('@/views/checkRecord/recordType'),
    meta: {
      title: '检查记录',
    }
  },
  {
    name: 'check-record-record-info',
    path: '/check-record/record-info',
    component: () => import('@/views/checkRecord/recordInfo'),
    meta: {
      title: '检查记录详情',
    }
  },
  {
    name: 'todo-list',
    path: '/todo/list',
    component: () => import('@/views/todo/todoList'),
    meta: {
      title: '隐患督办',
    }
  },
  {
    name: 'todo-info',
    path: '/todo/info',
    component: () => import('@/views/todo/todoInfo'),
    meta: {
      title: '隐患督办',
    }
  },
  {
    name: 'statistics',
    path: '/statistics',
    component: () => import('@/views/statistics/statistics'),
    meta: {
      title: '统计分析',
    }
  },
  {
    name: 'statistics-region',
    path: '/statistics-region',
    component: () => import('@/views/statistics/statistics-region'),
    meta: {
      title: '统计分析',
    }
  },
  {
    name: 'statistics-db-data',
    path: '/statistics/db-data',
    component: () => import('@/views/statistics/db-data'),
    meta: {
      title: '统计分析',
    }
  },
  {
    name: 'verification-record-record',
    path: '/verification-record/record',
    component: () => import('@/views/verificationRecord/record'),
    meta: {
      title: '核验记录',
    }
  },
  {
    name: 'verification-record-record-type',
    path: '/verification-record/recordType',
    component: () => import('@/views/verificationRecord/recordType'),
    meta: {
      title: '核验记录',
    }
  },
  {
    name: 'verification-record-record-info',
    path: '/verification-record/record-info',
    component: () => import('@/views/verificationRecord/recordInfo'),
    meta: {
      title: '核验记录详情',
    }
  },
  {
    name: 'verification-building-list',
    path: '/verification/building-list',
    component: () => import('@/views/verification/buildingList'),
    meta: {
      title: '房屋列表',
    }
  },
  {
    name: 'verification-mapbox',
    path: '/verification/mapbox',
    component: () => import('@/views/verification/mapbox'),
    meta: {
      title: '房屋',
    }
  },
  {
    name: 'verification-check-self',
    path: '/verification/check-self',
    component: () => import('@/views/verification/checkSelfData'),
    meta: {
      title: '自查信息',
    }
  },
  {
    name: 'verification-village-collect',
    path: '/verification/village-collect',
    component: () => import('@/views/verification/villageCollect'),
    meta: {
      title: '防火核验',
    }
  },
  {
    name: 'verification-village-check',
    path: '/verification/village-check',
    component: () => import('@/views/verification/villageCheck'),
    meta: {
      title: '防火核验',
    }
  },
  {
    name: 'task-list',
    path: '/task-list',
    component: () => import('@/views/taskList/taskList'),
    meta: {
      title: '任务列表',
    }
  },
  {
    name: 'task-detail',
    path: '/task-detail',
    component: () => import('@/views/taskList/taskDetail.vue'),
    meta: {
      title: '任务详情',
    }
  },
  {
    name: 'supervise',
    path: '/supervise',
    component: () => import('@/views/supervise/supervise.vue'),
    meta: {
      title: '非现场监管',
    }
  },
  {
    name: 'supervise-unchecked',
    path: '/unchecked/supervise',
    component: () => import('@/views/supervise/unchecked.vue'),
    meta: {
      title: '房屋列表',
    }
  },
]
const router = createRouter({
  history: createWebHistory(process.env.VUE_APP_BASE_ROUTER),
  routes
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})

export default router
